from django.contrib import admin
from .models import Experiment, ExperimentStep

class ExperimentStepInline(admin.TabularInline):
    model = ExperimentStep
    extra = 0

class ExperimentAdmin(admin.ModelAdmin):
    list_display = ('id', 'user', 'start_time', 'end_time', 'status', 'current_step', 'success')
    list_filter = ('status', 'success')
    search_fields = ('user__username', 'notes')
    readonly_fields = ('start_time',)
    inlines = [ExperimentStepInline]

admin.site.register(Experiment, ExperimentAdmin)
admin.site.register(ExperimentStep)
